home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-31 | 2.2 KB | 103 lines | [TEXT/ttxt] |
- #!/usr/bin/perl
-
- ############################################################
- # Set Variables
-
- $chatlog = "/usr/local/etc/httpd/htdocs/framechat/chatlog.html";
- $cgiurl = "http://www.muzik.com/cgi-bin/framechat/framechat.cgi";
-
- # Options:
-
- $line_breaks = 0;
- $allow_html = 0; # 1 = Yes; 0 = No
-
-
- # CONFIGURATION COMPLETE
- ############################################################
-
-
- # READ THE CHAT INFORMATION SENT BY CLIENT
-
- read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
-
- # UN WEBIFY TEXT
-
- @pairs = split(/&/, $buffer);
- foreach $pair (@pairs) {
- ($name, $value) = split(/=/, $pair);
-
- $value =~ tr/+/ /;
- $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
- $value =~ s/<!--(.|\n)*-->//g;
-
- if ($allow_html != 1) {
- $value =~ s/<([^>]|\n)*>//g;
- }
-
- $FORM{$name} = $value;
- }
-
-
-
- # EDIT THE CHAT FILE
-
- open (FILE,"$chatlog") || die "Can't Open $guestbookreal: $!\n";
- @LINES=<FILE>;
- close(FILE);
- $SIZE=@LINES;
-
-
-
- # OPEN CHAT LOG TO ADD NEW TEXT
-
- open (CHAT,">$chatlog") || die "Can't Open $guestbookreal: $!\n";
-
- for ($i=0;$i<=25;$i++) {
- $_=$LINES[$i];
-
- if (/<!--begin-->/) {
- print CHAT "<!--begin-->\n";
- print CHAT "<B>$FORM{'realname'}:</B> $FORM{'comments'}<br>\n";
-
- }
-
- else {
- print CHAT $_;
- }
-
- }
-
- close (CHAT);
-
-
- ############################################################
-
- &no_redirection;
-
- ############################################################
-
- # SEND CHAT TEXT WINDOW BACK TO CLIENT
- sub no_redirection {
-
- # RETURN THE CHAT INTERFACE TO THE CLIENT
-
- print "Content-Type: text/html\n\n";
- print "<html><head><title>Thank You</title>\n";
- print "<BODY BGCOLOR=\"#440099\" TEXT=\"#ffffff\" LINK=\"#00ffFF\" VLINK=\"#00ffff\" ALINK=\"#FF0000\"></head>\n";
-
- print "<body><form method=POST action=\"http://www.yourserver.com/cgi-bin/framechat/framechat.cgi\">\n";
- print "<input type=hidden name=\"realname\" value=\"$FORM{'realname'}\">\n";
-
- print "<TABLE BORDER=0 CELLPADDING=0 WIDTH=100%>";
- print "<TD ALIGN=center>";
- print "<textarea name=comments value=\"$FORM{'comments'}\"COLS=40 ROWS=4></textarea><p>\n";
- print "<TD ALIGN=center>";
- print "<input type=submit value=\"SPEAK\"><HR><input type=reset value=\"CLEAR\">\n";
- print "</form>\n";
- print "</table>";
- print "</body></html>\n";
-
- exit;
- }
-
-